package com.agent.user.controller.app;

import com.agent.common.entity.UserContext;
import com.agent.common.result.ApiResponse;
import com.agent.common.utils.UserInfoUtils;
import com.agent.user.service.UserService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户控制器
 * @author Jeff_Wan
 * @description 处理用户信息相关请求
 */
@RestController
@RequestMapping("/users")
@RequiredArgsConstructor
public class UserController {
    private final UserService userService;

    /**
     * 获取用户信息
     *
     * @return 用户上下文信息
     */
    @GetMapping("/me")
    public ApiResponse<UserContext> getUserById() {
        return ApiResponse.success(userService.getUserContext(UserInfoUtils.getUserId()));
    }
}